/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-03-23
 * Time: 14:14
 */
public class Test {
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }

    public static double func2(int n) {
        double sum = 0.0;
        for (int i = 1; i <= n; i++) {
            sum += 1.0 / fac(i);
        }
        return sum;
    }

    public static void main(String[] args) {
        double res = func2(20);
        System.out.println(res);
    }
}
